import 'package:spring_fairy/api/mood_track_api.dart';
import 'package:spring_fairy/api/user_api.dart';
import 'package:spring_fairy/model/mood_track.dart';
import 'package:spring_fairy/model/mood_track_point.dart';
import 'package:spring_fairy/model/user.dart';

void main() async {
  UserAPI userAPI = UserAPI();
  User? user = await userAPI.login('admin', '1234567');
  print(user);

  MoodTrackAPI moodTrackAPI = MoodTrackAPI();
  MoodTrack? moodTrack = MoodTrack();
  var now = DateTime.now();
  moodTrack.createdAt = now;
  moodTrack.trackDate = now;
  moodTrack.title = "${now.year}-${now.month}-${now.day}轨迹";

  moodTrack = await moodTrackAPI.createTrack(moodTrack);
  print(moodTrack);

  moodTrackAPI.getAllTrack().then(print);
  MoodTrackPoint moodTrackPoint = MoodTrackPoint(
    trackId: moodTrack!.id!,
    moodTypeId: 1,
    moodLevel: 1,
    latitude: 23.0,
    longitude: 34.0,
    locationName: "湖北师范大学",
    moodTime: DateTime.now(),
  );
  moodTrackAPI.addPoint(moodTrack!.id!, moodTrackPoint).then(print);
}